﻿using System;
using System.Windows.Forms;

namespace RPG1
{
    public partial class FormMain : Form
    {
        Weapon wpnMagician1;
        Weapon wpnNecromancer1;
        Weapon wpnMinotaur1;

        Magician magician1;
        Necromancer necromancer1;
        Minotaur minotaur1;
        Role enemy;
        public FormMain()
        {
            InitializeComponent();
        }
        private void FormMain_Load(object sender, EventArgs e)
        {
            wpnMagician1 = new Weapon("wand", 1, 1, 10, 0, 3);
            wpnNecromancer1 = new Weapon("magicRing", 1, 1, 30, 2, 3);
            wpnMinotaur1 = new Weapon("axe", 1, 1, 30, 0, 3);
            magician1 = new Magician("magician1", 100, 100,50, 0, 5, picBoxHero1, labelBottomHero1, labelTopHero1, wpnMagician1, picBoxWeapon1);
            necromancer1 = new Necromancer("necromancer1", 100, 100,30, 10, 4, pictureBoxMonster1, labelBottomMonster1, labelTopMonster1, wpnNecromancer1, picBoxWeapon2);
            minotaur1 = new Minotaur("minotaur1", 100, 100, 10, 10, 4, pictureBoxMonster2, labelBottomMonster2, labelTopMonster2, wpnMinotaur1);
            
            enemy = necromancer1;
        }

        private void picBoxHero1_Click(object sender, EventArgs e)
        {
            magician1.attack(enemy);
            if (enemy.CurrentLife <= 0) {
                enemy.died();
            }
            if (necromancer1.CurrentLife > 0)
                enemy = necromancer1;
            else if (minotaur1.CurrentLife > 0)
                enemy = minotaur1;
            else {
                MessageBox.Show("You Win!");
                return;
            }
            enemy.attack(magician1);
            
            if (magician1.CurrentLife <= 0) {
                MessageBox.Show("You Loss!");
            }
        }
    }
}
